home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
web
/
noweb
/
README
< prev
Wrap
Text File
|
1995-02-24
|
11KB
|
241 lines
This is version 2.7 of ``noweb'', a simple, extensible literate-
programming tool. noweb is available via anonymous ftp from the
Comprehensive TeX Archive Network, in directory web/noweb. CTAN
includes hosts ftp.shsu.edu, ftp.tex.ac.uk, and ftp.uni-stuttgart.de.
Note that if you simply get 'noweb.tgz', you'll be getting a bunch of
binary distributions that you probably don't want. Most users will
want either one of the binary distributions or else the source (src).
Fanatics can check out the contrib and examples directories.
The CTAN sites mirror the master directory bellcore.com:pub/norman/noweb.
You can also get the master tar file bellcore.com:pub/norman/noweb-2.7.tgz,
which contains source, contributed software, and examples, but no binaries.
To build noweb, change to the `src' directory and follow the
instructions in the file INSTALL.
WHAT'S NEW IN VERSION 2.7
This version includes support for converting LaTeX to HTML and support
for parsing nuweb files. So, if you want an HTML version of a nuweb
program, try this:
noweave -markup numarkup -filter l2h -html -index mumble.w > mumble.html
This version also has a more liberal copyright, some bug fixes, an
updated Hacker's Guide, and another useful new filter, elide. For
details see the CHANGES file.
Also, DIRECTORY LAYOUT AND INSTALLATION INSTRUCTIONS HAVE CHANGED.
My testing of the awk versions of the filters was cursory.
I welcome bug reports.
INTRODUCTION --- WHAT IS NOWEB, ANYWAY?
noweb is designed to meet the needs of literate programmers while
remaining as simple as possible. Its primary advantages are
simplicity, extensibility, and language-independence. noweb uses 5
control sequences to WEB's 27. The noweb manual is only 3 pages; an
additional page explains how to customize its LaTeX output. noweb
works ``out of the box'' with any programming language, and supports
TeX, latex, and HTML (Mosaic) back ends. A back end to support full
hypertext or indexing takes about 250 lines; a simpler one can be
written in 40 lines of awk. The primary sacrifice relative to WEB is
that code is not prettyprinted.
noweb has been used for five years both at Princeton and elsewhere.
It has been used for tens of thousands of lines of code in such
languages as awk, C, C++, Icon, Modula-3, PAL, perl, Promela, and
Standard ML.
If you already know you want to use noweb, you need only install it
and read the manual page. If you're just curious about noweb, read
the paper that appeared in the September 1994 issue of IEEE Software.
If you can't get Software, send me a postcard and I'll send you a
reprint.
If you're brand new to literate programming, check out the FAQ for the
USENET newsgroup comp.programming.literate. There are also some
resources available through the noweb home page:
ftp://bellcore.com/pub/norman/www/noweb/intro.html
WHAT YOU GET IN THIS DISTRIBUTION
This distribution contains the following directories:
binaries Pre-built distributions containing binaries and documentation
contrib software contributed by noweb users
examples sample noweb filters and programs in different languages
src Source code and documentation for noweb
Where appropriate, these directories have README files of their own.
BINARY DISTRIBUTIONS MAY NOT ALWAYS BE UP-TO-DATE, especially DOS
distributions.
EXTENSIBILITY
noweb provides extensibility by using the Unix toolkit philosophy.
The ``noweb,'' ``notangle,'' and ``noweave'' commands are built from
pieces, which are then assembled in pipelines using shell scripts.
The pieces include:
markup convert noweb file from human syntax to tool syntax
unmarkup inverse of markup
totex convert from tool syntax to TeX/latex markup
tohtml convert from tool syntax to HTML markup
nt `tangle' the tool form of the noweb file
mnt discover roots, then act like nt
noidx insert indexing and cross-reference information
finduses finds uses of identifiers
These pieces are combined by the scripts in the src/shell directory to
provide more than just weaving and tangling:
noweb analog of nuweb
notangle analog of TANGLE
noweave analog of WEAVE
nountangle tangle, but keep interleaved documentation in comments
noroots print names of all root chunks in a noweb file
nocount count number of lines of code and documentation.
nodefs extract defined identifiers for noweave -indexfrom
noindex build an external index for multi-file documents
WEAVING --- A TAR PIT
The worst aspect of literate programming is the enormous amount of
time wasted wrangling over what ``woven'' output should look like.
Although noweb does no prettyprinting, it is not entirely immune---
several people have complained about noweave's output or have sent me
changes that add more options to noweave. I resisted for years, but
with version 2.5 I finally succumbed. I let the number of options to
noweave double, and I have provided for too many options and hooks for
customizing the latex output. I won't let it happen again.
noweb doesn't try to be all things to all programmers, but it is very
easy to change. If you don't like noweave's formatting, you can read
tex/support.nw to learn how to customize it; look for the words
``style hook.'' (Reading noweb.sty directly is not recommended.) For
simple formatting, it might be easier to throw away noweave and make
your own. To help you get started, the shell directory contains
noweave.simple, a simplified version of noweave that Dave Hanson
created for use with C programs (it can't handle code with @ signs).
The Noweb Hacker's Guide (xdoc/guide.tex) explains the intermediate
language that noweb uses to represent literate programs.
The intermediate language makes it possible to extend noweave with a
language-dependent prettyprinter, as shown by contributions of an Icon
prettyprinter by Kostas Oikonomou and a guarded-command prettyprinter
by Conrado Martinez-Parra. (I haven't written a prettyprinter myself
because my experience with Spider taught me that prettyprinting is far
more trouble than it's worth.) Further contributions of
prettyprinters are welcome.
noweb comes with two cross-referencers for use with noweave. The
standard one is written in Icon, because Icon offers excellent
functionality and performance. Because Icon is not available on all
platforms, I profide an alternative, but inferior cross-referencer
written in awk. See the INSTALL file for details.
Cross-referencing makes formatting even more of a tar pit; the
cross-referencer itself takes about 300 lines, and extensive LaTeX
support is also required. I haven't made the attempt to write
cross-reference code for plain TeX. Anyone who has ideas for reducing
the number of options or for other ways to restore sanity to the
situation is urged to write to norman@bellcore.com.
INDEX AND IDENTIFIER CROSS-REFERENCE
To noweb, any string of nonwhite characters can be an identifier. A
human being or a language-dependent tool must mark definitions of
identifiers; noweb finds the uses using a language-independent
algorithm. The algorithm relies on an idea taken from the lexical
conventions of Standard ML. Characters are divided into three
classes: alphanumerics, symbols, and delimiters. If an identifier
begins with an alphanumeric, it must be delimited on the left by a
symbol or a delimiter. If it begins with a symbol, it must be
delimited on the left by an alphanumeric or a delimiter. If it begins
with a delimiter, there are no restrictions on the character
immediately to the left. Similar rules apply on the right-hand side.
The default classifications are chosen to make sense for commonly used
programming languages, so that noweb will not recognize `zip' when it
sees `zippy', or `++' when it sees `++:='. This trick works
surprisingly well, but it does not prevent noweb from spotting
identifiers in comments or string literals.
The basic assumption in noweb is that a human being will identify
definitions using the
@ %def mumble foo quux
construct. I have, however, found it very useful to write simple
filters that attempt to identify global definitions automatically.
Filters for Icon, TeX, and yacc all take about 30 lines of Icon code
and are included in the noweb distribution. Contributions for other
languages are encouraged. If you write a filter of your own, you can
put it in the $LIB directory with a name like `autodefs.pascal'.
noweave -index works well for short programs, but nodefs, noindex, and
noweave -indexfrom are there for large multi-file programs. See the
noindex man page for details.
NOTES
src/xdoc/techrep.* contains an early, almost unrecognizable version
of a paper describing noweb that appeared in IEEE Software in
September, 1994. You are probably better off writing me for a
reprint of the Software paper. (Send a postcard!)
The Noweb Hacker's Guide, which appears in src/xdoc/guide.*,
documents the representation of noweb files that is used by the
noweb tools, in case you want to write any tools of your own.
Simple tools (e.g. count the number of lines of interleaved
documentation) are trivial. If you write any tools, or you want
tools written (e.g. prettyprinters, index generators), let me know.
The icon directory contains Icon versions of most pipeline
stages. If you want to adapt noweb to work with a text processor
other than TeX or latex, they might provide a better starting point.
Perhaps the whole system should have been written in Icon from the
beginning, but I'm not going to do it over. Icon is available by
anonymous ftp from cs.arizona.edu.
I have a standing offer open to troff users: I will adapt noweb to
troff if you will tell me what the output should look like and you
will try to use the results.
Thanks to Preston Briggs for the Aho-Corasick recognizer, and for
helpful discussions.
Thanks to Dave Hanson for cpif.
Thanks to Dave Love for LaTeX wizardry.
Thanks to Joseph Reynolds for prodding me to fix [[...]].
Thanks to Bill Trost for the original HTML back end.
Thanks to Lee Wittenberg for the DOS binaries.
Send comments or questions to norman@bellcore.com.
I enjoy hearing from noweb users; if you have enjoyed noweb, why not
send me a local postcard for my collection? My address is:
Norman Ramsey
Bellcore
445 South Street
Morristown, New Jersey 07960
USA
COPYRIGHT
Noweb is copyright 1989-1995 by Norman Ramsey. All rights reserved.
You may use and distribute noweb for any purpose, for free. You may
modify noweb and create derived works, provided you retain the
copyright notice, but the result may not be called noweb without my
written consent. You may not sell noweb itself, but you may do
anything you like with programs created with noweb.
Noweb is not a Bellcore product. Bellcore makes no warranty and
accepts no liability for any software in this distribution. If you
find something useful, we're all surprised.